package com.company.设计模式.单例模式;

/**
 * @author uguoy089
 * @Description:
 * @Date: 2021/5/11 09:08
 */

public class Singleton1 {
    private static Singleton1 instance;

    private Singleton1() {
        System.out.println("懒汉式");
    }

    public static synchronized Singleton1 getInstance() {
        if (instance == null){
            instance = new Singleton1();
        }
        return instance;
    }
}
